<?php
include '../Module/SystemModule.php';
$sys=new SystemModule();
if(isset($_REQUEST["action"])){
    switch ($_REQUEST["action"]){
        case "login":
            $name	=isset($_REQUEST["name"])?EndcodeStr($_REQUEST["name"]):"";
            $pass	=isset($_REQUEST["pass"])?EndcodeStr($_REQUEST["pass"]):"";
            
            if($sys->login($name,$pass)){
                echo "true";
            }else{
                echo "Lỗi rồi. Vui lòng kiểm tra lại.<br/>".$sys->error;
            }
            break;
        case "changesetting":

            $paras	= json_decode($_REQUEST["paras"], true);
            foreach ($paras as $para){
                $sys->updateSetting($para["name"], $para["value"]);
            }
            echo "true";
            break;
    }    
}
?>
